
<#-- 导入模版定义文件-->
<#include "../template/template_editPage.ftl">
<@edit title="接口账号操作">
	<#if (supplierAccount.id)??>
		<#assign isEdit = true />
	<#else>
		<#assign isAdd = true />
	</#if>
	<body class="input">
	<script type="text/javascript">
	$().ready( function() {
	
		var $validateErrorContainer = $("#validateErrorContainer");
		var $validateErrorLabelContainer = $("#validateErrorContainer ul");
		var $validateForm = $("#validateForm");
		var $tab = $("#tab");        
		// Tab效果
		$tab.tabs(".tabContent", {
			tabs: "input"
		});		
		// 表单验证
		$validateForm.validate({
			errorContainer: $validateErrorContainer,
			errorLabelContainer: $validateErrorLabelContainer,
			wrapper: "li",
			errorClass: "validateError",
			ignoreTitle: true,
			rules: {
					"supplierAccount.name": {
						required: true,
						username: true,
						minlength: 1,
						maxlength: 	64	
					},
                "supplierAccount.everyDayQuota": {
                    required: true,
                    positively: true
                },
                "supplierAccount.supplierId": {
                    required: true
                },
                "supplierAccount.port": {
                    positively: true
                }
			},
			messages: {
					"supplierAccount.name": {
						required: "用户名不为空",
						username: "用户名只允许包含中文、英文、数字和下划线",
					    minlength: "用户名必须大于等于1",
						maxlength: "用户名必须小于等于64"   
					},	
                "supplierAccount.everyDayQuota": {
                    required: "每日限额不为空",
                    positively: "每日限额必须为大于0的数字！"
                },
                "supplierAccount.supplierId": {
                    required: "供货商不为空"
                },
                "supplierAccount.port": {
                    positively: "账户端口必须为大于0的数字！"
                }	
			},
			submitHandler: function(form) {
				$(form).find(":submit").attr("disabled", true);
				form.submit();
			}
		});
		<#if actionErrors??&&(actionErrors?size > 0)>
			$.dialog({type: "warn", content: "<#list errorMessages as list>${list}<br></#list>",
			 modal: true, autoCloseTime: 3000});
		</#if>
	});
	</script>
		<div class="body">
			<div class="inputBar">
				<h1><span class="icon">&nbsp;</span><#if isAdd??>添加接口账号<#else>编辑接口账号</#if></h1>
			</div>
			<div style="display: none;" id="validateErrorContainer" class="validateErrorContainer">
				<div class="validateErrorTitle">以下信息填写有误,请重新填写</div>
				<ul></ul>
			</div>			
			<form id="validateForm" class="validate" method="post" action="<#if isAdd??>${web_base}/recharge/supplier_account!addSupplierAccount.htm<#else>${web_base}/recharge/supplier_account!editSupplierAccount.htm</#if>">
			<table class="inputTable tabContent">
			<tr>
				<th>用户名:<input type="hidden" name="supplierAccount.id" value="<#if isEdit??>${(supplierAccount.id)!}</#if>" ></th>
				<td><input type="text" name="supplierAccount.name" value="${(supplierAccount.name)!}" ><label class="requireField">*</label></td>
			</tr>
			<tr>
				<th>密码:</th>
				<td><input type="password" <#if isAdd??>class="formText {required: true,messages: {required: '密码不为空!'}}"<#else>class="formText {minlength: 4, maxlength: 20}"</#if> 
				    name="supplierAccount.password" value="" ><#if isAdd??><label class="requireField">*</label></#if></td>
			</tr>
			<tr>
				<th>交易密码:</th>
				<td><input type="password" <#if isAdd??>class="formText {required: true,messages: {required: '交易密码不为空!'}}"<#else>class="formText {minlength: 4, maxlength: 20}"</#if> 
				    name="supplierAccount.tracePassword" value="" ><#if isAdd??><label class="requireField">*</label></#if></td>
			</tr>
			<tr>
				<th>扩展参数1:</th>
				<td><input type="text" class="formText" name="supplierAccount.extendsPara" value="${(supplierAccount.extendsPara)!}" ></td>
			</tr>
			<tr>
				<th>扩展参数2:</th>
				<td><input type="text" class="formText" name="supplierAccount.extendsPara2" value="${(supplierAccount.extendsPara2)!}" ></td>
			</tr>	
			<tr>
				<th>每日限额:</th>
				<td><input type="text" class="formText" name="supplierAccount.everyDayQuota" value="${money((supplierAccount.everyDayQuota)!)}" ><label class="requireField">*</label></td>
			</tr>
			<tr>
				<th>相关业务</th>
				<td><input type="checkbox" name="supplierAccount.enableQuery" value="<#if isEdit??>${supplierAccount.enableQuery?string('true','false')}</#if>" 
				    <#if isEdit??><#if supplierAccount.enableQuery?string('true','false')=="true" >checked="checked"</#if></#if>>允许查询
					<input type="checkbox" name="supplierAccount.enableRecharge" value="<#if isEdit??>${supplierAccount.enableRecharge?string('true','false')}</#if>"
					<#if isEdit??><#if supplierAccount.enableRecharge?string('true','false')=="true" >checked="checked"</#if></#if>>允许充值
				</td>
			</tr>
			<tr>
				<th>是否启用:</th>
				<td><select name="supplierAccount.enable">
				    <option value="false" <#if isEdit??><#if supplierAccount.enable?string('true','false')=="false">selected="selected"</#if></#if> >否</option>
					<option value="true"  <#if isEdit??><#if supplierAccount.enable?string('true','false')=="true">selected="selected"</#if></#if> >是</option>
				    </select>
				</td>
			</tr>	
			<tr>
				<th>供应商:</th>
				<td><select name="supplierAccount.supplierId">
				    <option value="">请选择供应商</option>
				    <#if supplierList??>
					<#list supplierList as row>
					<option value="${(row.id)!}" <#if isEdit??><#if supplierAccount.supplierId=="${(row.id)!}" >selected="selected"</#if></#if>>${(row.name)!}</option>
					</#list>
					</#if>
				    </select><label class="requireField">*</label></td>
			</tr>
			<tr>
				<th>账户端口:</th>
				<td><input type="text" class="formText" name="supplierAccount.port" value="${(supplierAccount.port)!}" ></td>
			</tr>
			<tr>
				<th>代理设置:</th>
				<td><input type="text" class="formText" name="supplierAccount.proxy" value="${(supplierAccount.proxy)!}" ></td>
			</tr>
			<tr>
				<th>其他:</th>
				<td><input type="checkbox" name="supplierAccount.sendMessage" value="<#if isEdit??>${supplierAccount.sendMessage?string('true','false')}</#if>"
				<#if isEdit??><#if supplierAccount.sendMessage?string('true','false')=="true" >checked="checked"</#if></#if>>短信设置</td>
			</tr>			
			<tr>
				<th>备注:</th>
				<td><textarea class="formText" name="supplierAccount.comment">${(supplierAccount.comment)!}
				</textarea></td>
			</tr>
			</table>
			<div class="buttonArea">
				<input type="submit" class="formButton" value="<#if isAdd??>添加<#else>修改</#if>" hidefocus="true" />&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="button" class="formButton" onclick="window.history.back(); return false;" value="返  回" hidefocus="true" />
			</div>
			</form>
		</div>
	</body>

</@edit>